package com.google.android.material.transformation;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
import o.aqs;
import o.aqw;

public class FabTransformationScrimBehavior extends ExpandableTransformationBehavior {
    private final aqw ˋ = new aqw(0, 150);
    private final aqw ˎ = new aqw(75, 150);

    public FabTransformationScrimBehavior(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public boolean ॱ(CoordinatorLayout coordinatorLayout, View view, View view2) {
        return view2 instanceof FloatingActionButton;
    }

    public boolean ॱ(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) {
        return super.ॱ(coordinatorLayout, view, motionEvent);
    }

    @NonNull
    protected AnimatorSet ˎ(View view, final View view2, final boolean z, boolean z2) {
        List arrayList = new ArrayList();
        ˏ(view2, z, z2, arrayList, new ArrayList());
        AnimatorSet animatorSet = new AnimatorSet();
        aqs.ˏ(animatorSet, arrayList);
        animatorSet.addListener(new AnimatorListenerAdapter(this) {
            final /* synthetic */ FabTransformationScrimBehavior ˎ;

            public void onAnimationStart(Animator animator) {
                if (z) {
                    view2.setVisibility(0);
                }
            }

            public void onAnimationEnd(Animator animator) {
                if (!z) {
                    view2.setVisibility(4);
                }
            }
        });
        return animatorSet;
    }

    private void ˏ(View view, boolean z, boolean z2, List<Animator> list, List<AnimatorListener> list2) {
        Animator ofFloat;
        aqw o_aqw = z ? this.ˎ : this.ˋ;
        if (z) {
            if (!z2) {
                view.setAlpha(0.0f);
            }
            ofFloat = ObjectAnimator.ofFloat(view, View.ALPHA, new float[]{1.0f});
        } else {
            ofFloat = ObjectAnimator.ofFloat(view, View.ALPHA, new float[]{0.0f});
        }
        o_aqw.ˊ(ofFloat);
        list.add(ofFloat);
    }
}
